// import request from '@/utils/request'
import http from '@/api/request'
import axios from 'axios'
import { getToken } from '@/utils/auth'
import { getConfig } from '@/config/config'
import CryptoJS from "crypto-js"
const api = {
	// 根据船员id获取证书列表
	getList(query) {
		return http({
			url: '/tug-api/mRate/list',
			method: 'get',
			params: query
		})
	},
	// 根据Id查询单条
	getDetailById(params) {
		return http({
			url: `/tug-api/mRate/getById`,
			method: 'get',
			params: params
		})
	},
	// 新建
	save(data) {
		return http({
			url: '/tug-api/mRate/save',
			method: 'post',
			data: data
		})
	},
	//删除
	remove(params) {
		return http({
			url: `/tug-api/mRate/removeBatch`,
			method: 'post',
			params: params
		})
	},
	//导出模板
	exportTemplate() {
		  return axios({
		  		url: `/tug-api/mRate/exportTemplate`,
		  		method: 'get',
		  		responseType:'blob',
		  		headers: {
		  			  'Authorization' : `Basic ${CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(`${getConfig('clientId')}:${getConfig('clientSecret')}`))}`,
		  			 'qdport-Auth': 'bearer ' + getToken(),
					 'token':getToken()
		  		  },
		  	})
	},
	//导出数据
	exportData(params) {
		  return axios({
		  		url: `/tug-api/mRate/exportData`,
		  		method: 'get',
		  		responseType:'blob',
				params:params,
		  		headers: {
		  			  'Authorization' : `Basic ${CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(`${getConfig('clientId')}:${getConfig('clientSecret')}`))}`,
		  			 'qdport-Auth': 'bearer ' + getToken(),
					 'token':getToken()
		  		  },
		  	})
	},
	//导入
	importData(data) {
	  return http({
	    url: `/tug-api/mRate/importRate`,
	    method: 'post',
	    data: data
	  })
	},
}
export default api